package cn.edu.just.firstjavaapp.l11;

public class StringDemo02 {
    public static void main(String[] args) {
        String s ="hello just";
        System.out.println(s.charAt(6));
        System.out.println(s.substring(6,9));
        System.out.println(s);
        String fruits = "apple,banana,apple,cherry,melon,apple,pearl.apple.bluecherry";
        String[] fs = fruits.split("[,.]",3);
        String l = String.join("...",fs);
        System.out.println(l);

        System.out.println(fruits.indexOf("apple"));
        System.out.println(fruits.indexOf("apple",1));
        System.out.println(fruits.indexOf("apple",27));

        System.out.println("--------");
        int index = fruits.indexOf("apple");
        while(index!=-1){
            System.out.println(index);
            index = fruits.indexOf("apple",index+1);

        }


    }
}
